<%@ taglib uri="/WEB-INF/myfaces_html.tld" 	prefix="h" %>
<%@ taglib uri="/WEB-INF/myfaces_core.tld" 	prefix="f" %>
<%@ taglib uri="/WEB-INF/tomahawk.tld"     	prefix="t" %>
<%@ taglib uri="/WEB-INF/myfaces_sandbox.tld"   prefix="s" %>
<%@ page import="java.util.*" %>
<%@ page import="it.azienda.managerworkstandard.modello.*" %>
 <%
     ArrayList listaDdt = (ArrayList) it.azienda.framework.utilita.Utilita.getRequest().getAttribute("listaDdt");
 %>
<f:view>
    <jsp:include page="/intestazione.jsp">
        <jsp:param name="titolo" value="Genera Fattura/Ddt"/>
    </jsp:include>
    <jsp:include page="/menu.jsp"/>
    <script language="javascript" src="./script/popup_full_center.js"></script>
    <script language="javascript" src="./script/ripristinoSessione.js"></script>
    <h:form binding="#{dettaglioGeneraFattura.form}">          
        <t:saveState value="#{beanGeneraFattura}"/>
        <table class="dettaglio" align="center" style="width:500px; height:200px"> 
            <tbody>          
         
            <tr>
                <td colspan="1" class="etichettaDettaglio"><strong><t:outputLabel for="ragioneSocialeCliente" value="Cliente" /></strong></td>
                <td colspan="2">
                    <h:selectOneMenu id="Cliente" value="#{beanGeneraFattura.idCliente}" valueChangeListener="#{dettaglioGeneraFattura.controlloCliente}" onchange="submit()">
                        <f:selectItems value="#{beanGeneraFattura.listaClienti}" />
                    </h:selectOneMenu>
                    <h:message style="color: red" for="Cliente" showDetail="true" showSummary="false" />
                </td>    
            </tr>                 
    
            <tr>                    
                <td colspan="3"> 
                <hr width="100%"> </td> 
            </tr>  
            
            <%
                if(listaDdt != null){
             for(int y=0; y<listaDdt.size(); y++){
                 BeanDdt beanDdt=(BeanDdt)listaDdt.get(y);
            %>
            <tr>         
                <td colspan="2"style="color: Black; font-family: Tahoma, Verdana, Geneva, Arial, Helvetica, sans-serif; font-size: 8pt; border: 2px ridge; background-color: HighlightText; width: 85%; padding-left: 3px;" >
                    Ddt N. <%=beanDdt.getCodice()%>, del <%=beanDdt.getDataString()%>, Importo Fatturato <%=beanDdt.getTotale()%>
                </td>
             
                <td colspan="1" width="15%">             
                    <input type="checkbox" name="idDdt" title="idDdt" value="<%=beanDdt.getId().toString()%>" />                                                           
                </td>                
            </tr>              
            <%
                }}
            %>
            
            <tr >
                <td>
                    <h:commandLink styleClass="commandLink_Style" dir="RTL" action="benvenuto" >
                        <t:graphicImage url="/image/go-home.png" border="0"/>
                    </h:commandLink>        
                </td>
                <td >
                    <t:commandButton id="stampa2" value ="GENERA FATTURE" action="#{dettaglioGeneraFattura.creaFattura}" >
                    </t:commandButton>    
                </td>
            </tr>   
        </table>
    
    </h:form> 
    
 
    <h:form id="erroriDataBase" rendered="false">
        <f:verbatim><table><td align="left" class="messaggiErrore" height="2px"></f:verbatim>           
        <h:messages style="color: red" showDetail="true" showSummary="false"/>
        <f:verbatim></td></table></f:verbatim>
    </h:form>  
   
    <jsp:include page="/piePagina.jsp"/>      
</f:view>